export function formatNumber(value: any, decimalPlaces: number, c: string) {
    if (value === null || value === undefined || value === '')
        return c;
    try {
        const number = parseFloat(value);
        // 检查转换结果是否为数字
        if (isNaN(number))
            throw new Error('Not a number');
        return Number(number.toFixed(decimalPlaces));
    } catch (error) {
        return c;
    }
}
// 今天昨天明天时间处理 v==3为昨天。v==6为今天。v==9为明天
export function dealTime(v:number) {
    const b = 24 * 60 * 60 * 1000; //一天的时间
    const day = new Date(); //当天的时间

    v === 3
      ? day.setTime(day.getTime() - b)
      : v === 6
        ? day.setTime(day.getTime())
        : day.setTime(day.getTime() + b);

    const dayMon =
      day.getMonth() + 1 >= 10
        ? day.getMonth() + 1
        : `0${  day.getMonth() + 1}`;
    const dayDat =
      day.getDate() >= 10 ? day.getDate() : "0" + day.getDate();
    const s = `${day.getFullYear()  }-${  dayMon  }-${  dayDat}`;
    return s;
  }